<?php
/*
Plugin Name: WP-TargetShooting
Plugin URI: http://code.google.com/p/wp-targetshooting/
Description: A wordpress plugin designed for managing target shooting leagues
Version: 0.0.1
Author: Aaron Jorbin (aaron@jorb.in)
Author URI: http://aaron.jorb.in/
*/
/*
 * 		Copywrite 2009 Aaron Jorbin (aaron@jorb.in)
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

define('wpts_location', '');
define('wpts_url', '');

require_once('wpts_functions.php');
add_action('init', 'wpts_tax_init' );

add_action('admin_menu', 'wpts_admin_page_init');
add_action('admin_init', 'wpts_admin_style_register');


function wpts_tax_init(){
	// Add all of my taxonomies (Events,
	register_taxonomy( 'wpts_shoots', 'wpts_shoot', array( 'hierarchical' => true, 'query_var' => true, 'rewrite' => false ) ) ;
	register_taxonomy( 'wpts_shooter_current_class', 'wpts_shoot', array( 'hierarchical' => false, 'query_var' => false, 'rewrite' => false ) ) ;
	register_taxonomy( 'wpts_shooter_current_club', 'wpts_shoot', array( 'hierarchical' => false, 'query_var' => false, 'rewrite' => false ) )  ;
}

function wpts_admin_style_register(){
	wp_register_style('wpts_settingspage',   plugins_url('wpts_admin_style.php?page=settings&type=css', __FILE__));
	wp_register_style('wpts_recordscore',   plugins_url('wpts_admin_style.php?page=record&type=css', __FILE__));
	wp_register_style('wpts_editscore',   plugins_url('wpts_admin_style.php?page=edit&type=css', __FILE__));
}

function wpts_settings_admin_styles(){
   wp_enqueue_style('wpts_settingspage');
}

function wpts_record_shoot_styles(){
	wp_enqueue_style('wpts_recordscore');
}
function wpts_edit_shoot_styles(){
	wp_enqueue_style('wpts_editscore');
}
function wpts_admin_page_init(){
	if (current_user_can('manage_categories') ){
		require_once('wpts_admin.php');
		$recordpage =	add_posts_page( 'record_shoot', 'Record Shoot', 3, 'wpts_record_shoot', 'wpts_record_shoot');
		add_action('admin_print_styles-' . $recordpage, 'wpts_record_shoot_styles');

		$editscore  =	add_posts_page( 'edit_shoot', 'Edit Shoot', 3, 'wpts_edit_shoot', 'wpts_edit_shoot');
		add_action('admin_print_styles-' . $editscore, 'wpts_edit_shoot_styles');

		$optionspage =	add_posts_page('confige_shooting_events', 'Configure Shooting Events', 3, 'wpts_configure_shooting_event', 'wpts_configure_shooting_event');
		add_action('admin_print_styles-' . $optionspage, 'wpts_settings_admin_styles');
	}
}

add_shortcode('target_shoot', 'wpts_show_shoot');

//Actions to add/process user profile information
add_action( 'show_user_profile', 'wpts_extra_profile_fields_show' );
add_action( 'edit_user_profile', 'wpts_extra_profile_fields_show' );
add_action( 'personal_options_update', 'wpts_extra_profile_fields_edit' );
add_action( 'edit_user_profile_update', 'wpts_extra_profile_fields_edit' );

// Add JS and Style to the pages
add_action( 'template_redirect', 'wpts_tablesorter');


?>
